/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.admin.entity.EstateElevator;
import org.springblade.modules.admin.vo.EstateElevatorVO;
import org.springblade.modules.admin.mapper.EstateElevatorMapper;
import org.springblade.modules.admin.service.IEstateElevatorService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;

/**
 * 物业电梯表 服务实现类
 *
 * @author ysq
 * @since 2022-05-27
 */
@Service
public class EstateElevatorServiceImpl extends BaseServiceImpl<EstateElevatorMapper, EstateElevator> implements IEstateElevatorService {

	@Override
	public IPage<EstateElevatorVO> selectEstateElevatorPage(IPage<EstateElevatorVO> page, EstateElevatorVO estateElevator) {
		estateElevator.setTenantId(AuthUtil.getTenantId());
		return page.setRecords(baseMapper.selectEstateElevatorPage(page, estateElevator));
	}

	@Override
	public List<Map<String, Object>> selectAddress(Long estateBuildingId) {
		return baseMapper.selectAddress(AuthUtil.getTenantId(), estateBuildingId);
	}

	@Override
	public List<Map<String, Object>> selectUser(Long estateBuildingId) {
		return baseMapper.selectUser(AuthUtil.getTenantId(), estateBuildingId);
	}

	@Override
	public List<EstateElevator> getListByEstateBuildingId(Long estateBuildingId) {
		return baseMapper.selectList(Wrappers.<EstateElevator>lambdaQuery().eq(EstateElevator :: getEstateBuildingId, estateBuildingId));
	}

	@Override
	public List<Map<String, Object>> selectSafeUser(Long estateBuildingId) {
		return baseMapper.selectSafeUser(AuthUtil.getTenantId(), estateBuildingId);
	}

	@Override
	public List<Long> listElevatorIdsByBuilding(String tenantId) {
		return baseMapper.listElevatorIdsByBuilding(tenantId);
	}

	@Override
	public List<EstateElevator> findAll() {
		return baseMapper.findAll();

	}
}
